<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>后台管理模板</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="../../css/global.css" media="all">
		<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
		<link rel="stylesheet" href="../../datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css">
	</head>
	<body>
		<div class="layui-layout layui-layout-admin" style="border-bottom: solid 5px #1aa094;">
			<!--头部导航-->
			<div class="layui-header header header-demo" ></div>
			<!--左侧导航-->
			<div class="layui-side layui-bg-black" id="admin-side">
			</div>
			<!--右侧具体内容-->
			<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;padding:20px" id="admin-body">
				<div class="title">修改管理员信息</div>
				<hr/>
				<form class="layui-form" action="manager.html" >
				<div class="layui-form-item">
					<img id="edit_adminUrl" src="../../images/demo1.png" style="margin:20px 20px 20px 50px;width: 60px"><div class="layui-btn layui-btn-radius layui-btn-primary" style="margin:20px 10px">修改头像</div>
				</div>
					<div class="layui-form-item" style="margin-right: 800px">
						<label class="layui-form-label">编号</label>
						<div class="layui-input-block">
							<input type="text" name="edit_adminId" required  lay-verify="required" placeholder="请输入编号" autocomplete="off" class="layui-input" value="1200121">
						</div>
					</div>
					<div class="layui-form-item" style="margin-right: 800px">
						<label class="layui-form-label">姓名</label>
						<div class="layui-input-block">
							<input type="text" name="edit_adminName" required  lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input" value="管理员1号">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">性别</label>
						<div class="layui-input-block">
							<input type="radio" name="edit_adminSex" value="男" title="男">
							<input type="radio" name="edit_adminSex" value="女" title="女" checked>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">类型</label>
						<div class="layui-input-block">
							<input type="radio" name="edit_adminPower" value="1" title="超级管理员" >
							<input type="radio" name="edit_adminPower" value="0" title="普通管理员" checked>
						</div>
					</div>
				</form>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="formDemo" id="confirmedit">确认修改</button>
						</div>
					</div>
			</div>
			<!--底部导航-->
			<div class="layui-footer footer footer-demo" id="admin-footer"></div>
			<!--JS模块-->
			<script type="text/javascript" src="../../layui/layui.js"></script>
			<script src="../../js/jquery-1.12.3.min.js"></script>
			<script src="../../js/index.js"></script>
			<script>
			layui.use('form', function() {
						var form = layui.form();

						C1 = window.location.href.split("?")[1];
						managerid = C1.split("=")[1];
						alert(C1);
						alert(managerid);

						var data = {
							"code": 200,
							"admin": {
								"adminId": 0412,
								"adminSex": "女",
								"adminName": "hwjlmn",
								"adminPower": 0,
								"adminUrl": "../../images/find_1.png",
								"adminNickname": "hwjlmn"
							}
						}

						/*$.ajax({
							url: "/randomdelivery/AdminController/Admin/" + managerid,
							type: "get",
							data: {},
							async: true,
							dataType: "json",
							contentType: "application/json",
							success: function(data) {
	
							},
							error: function() {
								alert("服务器出错");
							}
						})*/
						personinfo(data)

						function personinfo(data) {
							$("#edit_adminUrl").attr({
								"src": data.admin.adminUrl,
							});
							$("input[name='edit_adminId']").val(data.admin.adminId)
							$("input[name='edit_adminName']").val(data.admin.adminName)
							$("input[name='edit_adminSex']").val(data.admin.adminSex)
							$("input[name='edit_adminPower']").val(data.admin.adminPower)
						}

						$("#confirmedit").on("click", function() {
							/*$.ajax({
								url: "/randomdelivery/AdminController/Admin",
								type: "PUT",
								data: JSON.stringify({
									{
										"adminName": $("input[name='edit_adminName']").val(),
										"adminNickname": "魔女麦琪",
										"adminSex": $("input[name='edit_adminSex']").val(),
										"adminPower": $("input[name='edit_adminSex']").val()
										"adminUrl": $("#edit_adminUrl").src,
										"adminState": 1
									}
								}),
								async: true,
								dataType: "json",
								contentType: "application/json",
								success: function(data) {

								},
								error: function() {
									alert("服务器出错");
								}
							})*/
							ifeditDone(data)

							function ifeditDone(data) {
								if (data.code == 200) {
									window.location.href = "manager.html"
									// alert("编辑成功")
								} else {
									alert("fail")
								}
							}

						});
					})
			</script>
		</div>
	</body>
</html>